// app.js
App({
    data:{
    

    },
 
  onLaunch(){
    wx.cloud.init({
      env:'wx-weather-5gkx49va740e449e'
    });  
    const db=wx.cloud.database();
    db.collection('users').get({
        success:res=>{
          if(res.data.length>0){
            this.globalData.userInfo=res.data[0]
          }
        }
    })
    this.diaryshow()
  }, 
  diaryshow() {
    var db = wx.cloud.database()
    let that = this
    db.collection('diary')
      .get({
        success: function (res) {
          res.data.sort(function (a, b) {
            return a.date<b.date?1:-1;
        });
          that.setData({
            diarylist: res.data
          })
       
        }
      })

  },
  globalData:{
    userInfo:null
  },
onShow(){
  // this.diaryshow()
},


 
})
